package pc.nick.http;

public class HttpServlet implements Servlet{
    @Override
    public void init() {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) {

    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) {

    }

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response) {
           String method = request.getMethod();
           if("GET".equals(method)) {
               doGet(request, response);
           } else if("POST".equals(method)) {
               doPost(request, response);
           }
           // 还有 HEAD TRACE DELETE PUT等方法
    }
}
